<template>
  <view :style="{height : pageHeight + 'px'}" class="content">
    <view class="groupList">
      <view v-for="(item,index) in groupList" :key="index" class="groupRoute">
        <view class="groupTitle">
          <view class="groupNum">
            {{ item.name }}
          </view>
          <view class="title">
            小组路线
          </view>
        </view>
        <view class="routeList">
          <view v-for="(ite,index) in item.AllList" :key="index" class="routebox">
            <view :class="[ite.locked?'completedBg':'progressBg']" class="routeItem">
              <view :class="[ite.locked? 'completedIndex':'progressIndex']" class="routeIndex">
                {{ index + 1 }}
              </view>
              <view class=" routeName">
                {{ ite.name }}
              </view>
              <view class="status">
                <text v-if="ite.locked" style="color: #FF9802;">已进行</text>
                <text v-else style="color: #4186F5;">未进行</text>
              </view>
            </view>
          </view>
        </view>
      </view>
    </view>
  </view>
</template>

<script>
import {
  getSequence,
  adjustSequence
} from '@/api/tourplan.js'

export default {
  data() {
    return {
      pageHeight: 750,
      groupList: [],
    }
  },
  onLoad(options) {
    const that = this
    uni.getSystemInfo({
      success: function (res) {
        that.pageHeight = res.windowHeight
      }
    });
    that.initData(options)
  },
  methods: {
    initData(options) {
      const that = this
      that.itineraryId = options.itineraryId
      that.groupId = options.groupId
      that.getSenicSequenceList(that.itineraryId)
    },
    //获取顺序列表
    getSenicSequenceList(itineraryId) {
      const that = this
      getSequence({
        itineraryId: itineraryId,
        tel: uni.getStorageSync('userinfo').phone
      }).then(res => {
        that.groupList = res
      }).catch(err => {
        uni.showToast({
          title: err,
          icon: 'none',
          duration: 3000
        })
      })
    },
  }
}
</script>

<style>
@import url('selectRouteTL.css');
</style>
